home *** CD-ROM | disk | FTP | other *** search
/ The Programmer Disk / The Programmer Disk (Microforum).iso / xpro / tutor / pro14 / reconcil.bas < prev   
Encoding:
BASIC Source File  |  1990-12-21  |  2.9 KB  |  64 lines

  1. 10 'RECONCIL.BAS - Program to aid in reconciling our checking account file
  2. 20 'From the GWBASIC Tutorial Series (GWBT07, December 1990)
  3. 30 'First task - assign storage for uncleared checks, by number and amount...
  4. 40 DIM CHECKNUMBER(50),CHECKAMOUNT(50)
  5. 50 'These arrays will be used to store the number and amount of all checks that
  6. 60 'have not cleared the bank (been cashed) yet.
  7. 70 'Next step is to open the CHECKS.DAT file, read in checks and see if they
  8. 80 'show as cleared on the statement...
  9. 90 CLS:KEY OFF
  10. 100 OPEN "CHECKS.DAT" FOR INPUT AS #1
  11. 110 WHILE NOT EOF(1)
  12. 120 LINE INPUT #1,CHECKDATA$
  13. 130 'Remember our list of data locations in each record, now extract the needed
  14. 140 'information to decide if a check has cleared yet...
  15. 150 CHECKNO=VAL(LEFT$(CHECKDATA$,6))
  16. 160 CHECKAMOUNT=VAL(MID$(CHECKDATA$,67,6))
  17. 170 'Print check number and amount on screen so user can decide if it has been
  18. 180 'cashed or not..
  19. 190 LOCATE 10,1,0
  20. 200 PRINT USING "CHECK NUMBER: ######    CHECK AMOUNT: $$#####.##";CHECKNO,CHECKAMOUNT
  21. 210 LOCATE 15,1,0
  22. 220 INPUT "Has this check cleared the bank?  <Y>es or <N>o",CLEARED$
  23. 230 'The user might enter just the letter 'y', or a capital 'Y', or maybe the
  24. 240 'words 'Yes' or 'yes', so we need to figure out a way to be sure.  Let's
  25. 250 'take the LEFT character, which should either be 'y' or 'Y' either way...
  26. 260 CLEARED$=LEFT$(CLEARED$,1)
  27. 270 'Now see if it's a 'y' and if so, skip to next check...
  28. 280 IF CLEARED$="Y" OR CLEARED$="y" THEN GOTO 350
  29. 290 'If check has not cleared, put it in the array after adding one to the
  30. 300 'counter...
  31. 310 COUNTER=COUNTER+1
  32. 320 CHECKNO(COUNTER)=CHECKNO
  33. 330 CHECKAMOUNT(COUNTER)=CHECKAMOUT
  34. 340 'Whether cleared or not, go on to next check in file...
  35. 350 WEND
  36. 360 CLS
  37. 370 PRINT "I need a little more information to reconcile your checking account."
  38. 380 PRINT "Please provide the following information..."
  39. 390 PRINT
  40. 400 PRINT "What is the current balance in your checkbook",CHECKBOOKBALANCE
  41. 410 PRINT "What service fees need to be deducted",SERVICEFEES
  42. 420 PRINT "What is the current balance on your statement",STATEMENTBALANCE
  43. 430 PRINT "Working..."
  44. 440 'First, deduct outstanding checks from statement balance
  45. 450 FOR N=1 TO COUNTER
  46. 460 STATEMENTBALANCE=STATEMENTBALANCE-CHECKAMOUNT(N)
  47. 470 NEXT N
  48. 480 'Next, deduct service fees from the checkbook balance
  49. 490 CHECKBOOKBALANCE=CHECKBOOKBALANCE-SERVICEFEES
  50. 500 'Finally, the checkbook and statement balances should agree...
  51. 510 PRINT "Reconciliation complete!  Final balances are as follows:"
  52. 520 PRINT USING "Balance in Checkbook Register: $$#####.##";CHECKBOOKBALANCE
  53. 530 PRINT USING "Reconciled Statement Balance : $$#####.##";STATEMENTBALANCE
  54. 540 PRINT
  55. 550 PRINT "The two amounts above should agree.  If they do not, you need to"
  56. 560 PRINT "re-check your work and try again..."
  57. 570 PRINT
  58. 580 PRINT "Press any key to end program
  59. 590 WHILE INKEY$=":wend
  60. 600 CLOSE
  61. 610 RESET
  62. 620 END
  63. 630 'End of program - RECONCIL.BAS
  64.